TRACK equ 0
HEAD equ 0
SEC  equ 2

;=============
segment code align=16 vstart=0x7c00
; 设置段寄存器
mov ax, 0x1000     
mov ds, ax
mov es, ax ; ES寄存器指向内存0x10000区域

; 设置LBA 100扇区
mov ah, 0x02        ; BIOS中断 13h，读取扇区
mov al, 0x01        ; 读取1个扇区
mov ch, 0x00        ; 柱面号 0
mov cl, 0x02        ; 扇区号 100
mov dh, 0x00        ; 磁头号 0
mov dl, 0x00        ; 驱动器号 0 (软盘)

; 读取软盘的LBA 100扇区到内存地址0x10000
mov bx, 0x0000      ; BX指向0x0000 (0x1000:0x0000 = 0x10000)
int 0x13            ; 调用BIOS中断读取扇区

; 检查读取是否成功
jc disk_error       ; 如果载入失败，跳转到错误处理

; 显示出来
mov cx,24
mov di,0x0000
mov ax,0xb800
mov es,ax
mov bx,0x0000
@ll:
    mov al,[bx]
    mov [es:di],al
    inc di
    mov byte [es:di],0x07
    inc di
    inc bx
    loop @ll

jmp $

disk_error:
    ; 错误提示，然后进入低功耗模式
    mov ax,0xb800
    mov es,ax
    mov byte [es:0x00],"E"
    mov byte [es:0x01],0x07
    mov byte [es:0x02],"r"
    mov byte [es:0x03],0x07
    mov byte [es:0x04],"r"
    mov byte [es:0x05],0x07
    mov byte [es:0x06],"o"
    mov byte [es:0x07],0x07
    mov byte [es:0x08],"r"
    mov byte [es:0x09],0x07
    hlt                ; 进入停机状态


times 510-($-$$) db 0
db 0x55, 0xaa